package com.tz.init;

import com.tz.AppConfig;
import com.tz.entity.FaqItem;
import com.tz.service.FaqService;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Created by robin on 2016/8/5 0005.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class InitData {
    @Autowired
    private FaqService faqService;

    @Test
    public void test1(){
        FaqItem item1 = new FaqItem();
        item1.setName("faq1");
        item1.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        FaqItem item2 = new FaqItem();
        item2.setName("faq2");
        item2.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        FaqItem item3 = new FaqItem();
        item3.setName("faq3");
        item3.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        FaqItem item4 = new FaqItem();
        item4.setName("faq4");
        item4.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        FaqItem item5 = new FaqItem();
        item5.setName("faq5");
        item5.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        FaqItem item6 = new FaqItem();
        item6.setName("faq6");
        item6.setContent("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");

        faqService.save(item1);
        faqService.save(item2);
        faqService.save(item3);
        faqService.save(item4);
        faqService.save(item5);
        faqService.save(item6);

    }
}
